package cz.proks.easyhelpdesk.gae.api.impl.db;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import cz.proks.easyhelpdesk.api.CategoryApi;
import cz.proks.easyhelpdesk.api.config.Configuration;
import cz.proks.easyhelpdesk.api.model.Category;

@Repository(Configuration.DB.CATEGORY_API)
@Scope("prototype")
public class CategoryApiImpl extends BaseHelpdeskApiImpl<Category> implements CategoryApi {

    @Override
    protected Class<Category> getDomainClass() {
        return Category.class;
    }

    @Override
    protected Category getDboObject(Category entity) {
        cz.proks.easyhelpdesk.gae.api.impl.dbo.Category dbo = instantiateDbo(entity);
        
        if (dbo != null)
            dbo.toDbo(entity);
        
        return dbo;
    }    
}
